home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1995 November
/
EnigmA AMIGA RUN 02 (1995)(G.R. Edizioni)(IT)[!][issue 1995-11][Skylink CD].iso
/
earcd
/
gfx
/
flood_it.lha
/
Flood_It
< prev
Wrap
Text File
|
1995-08-04
|
1KB
|
88 lines
/* Copyright © Krzysztof Sporysz vel Kivi
Poland -> Cracow
$Ver 2.0 22-Jul-95 21:53
*/
OPTIONS RESULTS
GetRegionArea
IF result = "" THEN EXIT
PARSE VAR result startx starty width height
Region FULL
endx = startx + width
endy = starty + height
ActiveColor 1
GetPalette 1
color = result
IF width > height THEN
cnt = height / 2
ELSE
cnt = width / 2
BeginBar 'Remove' width*height+10
points = 0
Message 'Removing points. Wait.'
DO i = 0 TO cnt
xs = startx + i
xe = endx - i
ys = starty + i
ye = endy - i
points = points+(2*(xe-xs)+2*(ye-ys)-4)
Bar points
y = ys
DO x = xs TO xe
CALL WhatIs
END
x = xe
DO y = ys+1 TO ye
CALL WhatIs
END
y = ye
DO x = xe-1 TO xs BY -1
CALL WhatIs
END
x = xs
DO y = ye-1 TO ys+1 BY -1
CALL WhatIs
END
END
Redraw
EndBar
EXIT
WhatIs:
GetPixel x y
IF result = color THEN DO
rl = 0
g = 0
bl = 0
c = 0
a = x ; b = y-1
CALL AddPixel
a = x ; b = y+1
CALL AddPixel
a = x+1 ; b = y
CALL AddPixel
a = x-1 ; b = y
CALL AddPixel
rl = rl / c
g = g / c
bl = bl / c
PutPixel x y rl g bl
END
RETURN
AddPixel:
GetPixel a b
IF result ~= color THEN DO
point = result
PARSE VAR point pr pg pb
rl = rl + pr
g = g + pg
bl = bl + pb
c = c + 1
END
RETURN